Xbasic

LINE_INSERT Function

Syntax

string as C = line_insert(C string ,C string_to_insert ,* position [,L before ])

Arguments

string

A CR-LF delimited list.

string_to_insert

A line to insert into List. Character

position

Can either be a line number (numeric value) or a string found in an existing line. Position can include wildcard characters. Before .T. = Insertion made before Position; .F. = Insertion made after Position.

before

Logical

Description

Inserts a CRLF delimited string into another string at the specified position. Position can either be a line number or a string found in an existing line. Position can include wildcard characters. If before is .t. then insertion is made before position.

Discussion

The LINE_INSERT() function inserts one or more lines into a CR-LF delimited list.

Example

?string
= green
blue
yellow
orange
purple
insert = "fuschia"
?line_insert(string, insert, 2)
= green
blue
fuschia
yellow
orange
purple
?line_insert(string, insert, 2, .t.)
= green
fuschia
blue
yellow
orange
purple
?line_insert(string, insert, "orange")
= green
blue
yellow
orange
fuschia
purple
?line_insert(string, insert, "or*", .t.)
= green
blue
yellow
fuschia
orange
purple

See Also